/*
 * BlocoGraphCell.java
 *
 * Created on 3 de Junho de 2007, 00:59
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package org.jerm.Interface.JGraph_Diagrama;
import java.awt.Color;

import org.jgraph.graph.GraphConstants;

/**
 *
 * @author Tiago Falcao
 */
public class Heranca extends BlocoGraphCell{
    
    protected boolean disjunta=true;
    protected boolean total=false;
    
    
    /** Creates a new instance of BlocoGraphCell */
    public Heranca(String Nome) {
        this(20,20,Nome);
    }
    
    public Heranca(double x,double y, String Nome) {
        this(x,y,40,40,Color.white,Nome);
    }
    
    public Heranca(double x,double y, double w, double h, 
                    Color bg, String Nome){
        this(x,y,w,h,bg,Nome,"Interface.JGraph_Diagrama.CirculoView");
    }
    
    public Heranca(double x,double y, double w, double h, 
                    Color bg, String Nome, String viewClass){
        super(x,y,w,h,bg,Nome,viewClass);
        updateName();
        GraphConstants.setEditable(getAttributes(),false);
    }
    
    public boolean isTotal(){
        return total;
    }
    
    public boolean isDisjunta(){
        return disjunta;
    }
    
    public void setTotal(boolean total){
        this.total=total;
        updateName();
    }
    
    public void setDisjunta(boolean disjunta){
        this.disjunta=disjunta;
        updateName();
    }
    
    public void updateName(){
        String Nome;
        if(isDisjunta())
            Nome="d,";
        else
            Nome="o,";
        if(isTotal())
            Nome+="t";
        else
            Nome+="p";
        GraphConstants.setValue(getAttributes(),Nome);
        
    }
    
}
